
/**
 * created on 2012-04-28
 * @author  qiujz
 * @version 1.0
 *
 * Copyright (c)  Founder Software (Suzhou) Co., Ltd.  2012
 *  All rights reserved.
 *
 * 
 * ================================================================
 * Change Revision
 * ---------------------------------------------------------------
 *    DATE                BY                   COMMENT
 * ---------------------------------------------------------------
 * 2012-04-28         qiujz                Create class
 * 
 *
 * ================================================================
 */	

package com.qjz.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.founder.mh.framework.dao.impl.BaseDaoImpl;
import com.qjz.dao.ISchoolInfoDao;
import com.qjz.entity.SchoolInfoTo;	

public class SchoolInfoDaoImpl extends BaseDaoImpl implements ISchoolInfoDao {
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.ISchoolInfoDao
	 *      #searchSchoolInfoList(java.util.Map)
	 */
	public List<SchoolInfoTo> searchSchoolInfoList(
			Map<String, Object> paramMap) {
		return this.queryForList("schoolInfo.searchSchoolInfo", paramMap);
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.ISchoolInfoDao
	 *      #searchSchoolInfoPagination(java.util.Map, int, int)
	 */
	public List<SchoolInfoTo> searchSchoolInfoPagination(
			Map<String, Object> paramMap, int startRow, int endRow) {
		return this.queryForListPagination("schoolInfo.searchSchoolInfo",
				paramMap, startRow, endRow);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.ISchoolInfoDao
	 *      #getSchoolInfoCount(java.util.Map)
	 */
	public Integer getSchoolInfoCount(Map<String, Object> paramMap) {
		return (Integer) this.queryForObject("schoolInfo.getSchoolInfoCount", paramMap);
	}
	
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.ISchoolInfoDao
	 *      #getSchoolInfoByPrimaryKey(int)
	 */
	public SchoolInfoTo getSchoolInfoByPrimaryKey(int sid) {
		return (SchoolInfoTo) queryForObject("schoolInfo.getSchoolInfoByPrimaryKey", sid);
	}
	

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.ISchoolInfoDao
	 *      #insertSchoolInfo(com.qjz.entity.SchoolInfoTo)
	 */
	public Object insertSchoolInfo(SchoolInfoTo schoolInfo) {
		return this.create("schoolInfo.insertSchoolInfo", schoolInfo);		
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.ISchoolInfoDao
	 *      #updateSchoolInfoByBean(com.qjz.entity.SchoolInfoTo)
	 */
	public int updateSchoolInfoByBean(SchoolInfoTo schoolInfo) {
		return this.update("schoolInfo.updateSchoolInfo.byBean", schoolInfo);
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.ISchoolInfoDao
	 *      #updateSchoolInfoByProperty(java.util.Map)
	 */
	public int updateSchoolInfoByProperty(Map<String, Object> paramMap) {
		return this.update("schoolInfo.updateSchoolInfo.byProperty", paramMap);
	}

	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.ISchoolInfoDao
	 *      #deleteSchoolInfoByPrimaryKey(int)
	 */
	public int deleteSchoolInfoByPrimaryKey(int sid) {
		return this.delete("schoolInfo.deleteSchoolInfoByPrimaryKey", sid);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.ISchoolInfoDao
	 *      #deleteSchoolInfoBatch(int[])
	 */
	public void deleteSchoolInfoBatch(int[] keyArray) {
		SqlMapClient sqlMap = this.getSqlMapClient();
		try {
			sqlMap.startBatch();
			for (int key : keyArray) {
				sqlMap.delete("schoolInfo.deleteSchoolInfoByPrimaryKey",
						key);
			}
			sqlMap.executeBatch();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
		
}	
	
